<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%!
	 public static String getExceptionAllinformation(Exception ex) {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         PrintStream pout = new PrintStream(out);
         ex.printStackTrace(pout);
         String ret = new String(out.toByteArray());
         pout.close();
         try {
              out.close();
         } catch (Exception e) {
         }
         return ret;
	}
%>
<%
	msg = new Message(500, "当前访问人数过多，请稍候再试");
	Exception e = (Exception)request.getAttribute("exception");
	if (e != null) {
		String errName = e.getClass().getName();
		if (errName.equals("java.io.FileNotFoundException")) {
			msg.setErrcodeAndErrmsg(404, "没有这个接口,请核对");
		} 
	}
	Tools.encryptPrint(out, msg);
	Map map = new HashMap();
	map.put("userid", "yanghx");
	map.put("reqpath", (String)request.getAttribute("reqpath"));
	map.put("content", getExceptionAllinformation(e));
	map.putAll(input.getParameters());
	HashMap logMap = new HashMap();
	logMap.put("ipv4", input.getIp());
	logMap.put("hospital", hospital + "");
	logMap.put("app_type", input.getDesc("app_type"));
	logMap.put("create_time", System.currentTimeMillis());
	logMap.put("useragent", input.getUseragent());
	logMap.put("params", JSONUtil.toJson(map));
	logMap.put("url", (String)request.getAttribute("reqpath"));
	Integer logId = (Integer)DBTools.db("basedb").addItem("sys_log", logMap);
	map.put("log_id", logId + "");
	HttpUtil.post("http://demoapi.eeesys.com:18088/enterprise/999/error/push.jsp", map);
%>